Ssh key generation and folder files explain
Ssh protocol version 1 key generation.
ssh-keygen |
When asked for a “passphrase”, we won’t enter one. Just press enter twice.
It will generate 2 files:
/home/user/.ssh/id_rsa.pub /home/user/.ssh/id_rsa |
2. Copy id_rsa.pub to the remove host
scp id_rsa.pub user@hostname:/home/user/.ssh/id_rsa.pub |
or
ssh-copy-id -i .ssh/id_rsa.pub user@hostname |
3. Login to remote host and add to authorized_keys file
ssh hostname -v cd /home/user/.ssh cat id_rsa.pub >> authorized_keys chown user /home/user/.ssh/authorized_keys chgrp user /home/user/.ssh/authorized_keys |
Ssh protocol version 2 key generation.
ssh-keygen -t dsa |
When asked for a “passphrase”, we won’t enter one. Just press enter twice.
It will generate 2 files:
/home/user/.ssh/id_dsa.pub /home/user/.ssh/id_dsa |
2. Copy id_dsa.pub to the remove host
scp id_dsa.pub user@hostname:/home/user/.ssh/id_dsa.pub |
or
ssh-copy-id -i .ssh/id_rsa.pub user@hostname |
3. Login to remote host and add to authorized_keys2 file
ssh hostname -v cd /home/user/.ssh cat id_dsa.pub >> authorized_keys2 chown user /home/user/.ssh/authorized_keys2 chgrp user /home/user/.ssh/authorized_keys2 |